package com.wyp168.jvm001.stack;

import java.util.Date;

/**
 * @ClassName LocalVariableDemo001
 * @Description 局部变量表测试
 * @Author wyp168
 * @Date 2022/8/3 11:33
 */
public class LocalVariableDemo001 {

    static{
        boolean isTest = true;
    }
    public static void main(String[] args) {
        LocalVariableDemo001 test = new LocalVariableDemo001();
        int nums = 1;
        test.test01();

        test.add();
    }

    public void test01() {
        Date date = new Date();
        String str = "Hello, Local Variables Table";
        test03(str,date);
        System.out.println(date + "----->" + str);
    }

    public static void staticMethodTest() {
        LocalVariableDemo001 test = new LocalVariableDemo001();
        Date date = new Date();
        String desc = "test Static Local Variable Table";
        System.out.println(date + desc);
    }

    public String test03(String str, Date date) {
        Date dateT3 = null;
        String nameT3 = "wyp168T3";
        double weightT3 = 90.5;
        int age = 21;

        return dateT3 + nameT3;
    }

    public void slotTest() {
        String a = "aaa";
        {
            String b = "bbb";
            b += a;
        }
        int c = 123;
    }

    /*
        变量的分类
            按照类型分：基本数据类型、引用数据类型
            按照作用域范围分：
                成员变量：
                    类变量（static修饰）
                    实例变量
                局部变量
     */



    public void add() {
        //第一类问题
        int i1 = 10;
        i1++;
        int i2 = 10;
        ++i2;

        //第二类问题
        int i3 = 10;
        int i4 = i3++;

        int i5 = 10;
        int i6 = ++i5;

        //第三类问题
        int i7 = 10;
        i7 = i7++;

        int i8 = 10;
        i8 = ++i8;

        //第四类问题
        int i9 = 10;
        int i10 = i9++ + ++i9;
        System.out.println(i10);
    }
}
